package com.aduerr.v1shouyin.mvp.activity;

import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;


import butterknife.BindView;
import butterknife.ButterKnife;
import com.aduerr.v1shouyin.R;

/**
 * 通用状态栏基类
 * <p>
 * Created by fyf on 2018/3/20 0020.
 */

public abstract class ToolbarBaseActivity extends AppCompatActivity {

    public static final String TAG = "ToolbarBaseActivity";

    @BindView(R.id.toolbarBanner)
    protected Toolbar toolbar;


    @LayoutRes
    protected abstract int contentViewLayoutRes();

    protected void prepareContentView() {
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        prepareContentView();
        super.onCreate(savedInstanceState);
        setContentView(contentViewLayoutRes());
        ButterKnife.bind(this);
        initToolbar();

    }


    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
        if(intent == null) return;
        if(intent.getComponent() == null) return;
        String className = intent.getComponent().getClassName();

    }

    protected void initToolbar() {
        toolbar.setNavigationIcon(R.drawable.img_back_default);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBackPressed();
            }
        });
    }

    @Override
    public void finish() {
        super.finish();
        /*if (!((Object) this).getClass().equals(MainActivity.class)) {
            overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        }*/

    }

    @Override
    protected void onDestroy() {

        super.onDestroy();
    }

}
